package cc.mrbird.febs.moive.controller;


import cc.mrbird.febs.moive.domain.DataTop;
import cc.mrbird.febs.moive.service.DataTopService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@Validated
@RestController
@RequestMapping("dataTop")
@Api("总票房top20")
public class DataTopController {
    @GetMapping("/hello")
    public String hello(){
        return "helloworld";
    }

    @Autowired
    private DataTopService service;

    @GetMapping("/getData")
    @ApiOperation(value = "总票房top20")
    public List<DataTop> getData() {
        log.info("/getData");
        List<DataTop> data =  service.getData();
        return data;
    }


    @GetMapping("/getData2")
    @ApiOperation(value = "总票房最差top20")
    public List<DataTop> getData2() {
        log.info("/getData2");
        List<DataTop> data =  service.getData2();
        return data;
    }

}
